package chapter4.homework;

/**
 * 将洛书幻方顺时针旋转90度
 *
 * @author 张玮婷 20245080902061
 */

public class newSqure {
    public static void main(String[] args) {
        int[][] magicSquare = {
                {4, 9, 2},
                {3, 5, 7},
                {8, 1, 6}
        };
        int[][] newSqure = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                newSqure[i][j] = magicSquare[2 - j][i];
            }
        }

            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++) {
                    System.out.print(newSqure[i][j] + " ");
                }
                System.out.println();
            }
        }
    }
